﻿using System;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Org.BouncyCastle.Crypto;
using XiAnAirport.BUS;
using XiAnAirport.Models;

namespace XiAnAirport.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    [Authorize]
    public class SpareController : ControllerBase
    {
        public IHttpContextAccessor _contextAccessor;
        private readonly IHostingEnvironment _hostingEnvironment;
        private JwtSettings _jwtSettings;
        public SpareController(IHttpContextAccessor contextAccessor, IHostingEnvironment hostingEnvironment, IOptions<JwtSettings> jwtSettingsAccesser)
        {
            _contextAccessor = contextAccessor;
            _hostingEnvironment = hostingEnvironment;
            _jwtSettings = jwtSettingsAccesser.Value;
        }

        /// <summary>
        /// 新增备件信息
        /// </summary>
        /// <param name="spareInfo">备件信息</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("AddSpare")]
        public ResponseMessage AddSpare(SpareInfo spareInfo)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                spareInfo.creationPerson = _contextAccessor.HttpContext.Session.GetString("UserName");
                message = BUS.AddSpare(spareInfo);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = " 新增备件信息" + spareInfo.spareName;
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 1;
                message.errmsg = "新增备件信息失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "新增备件信息";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }

        /// <summary>
        /// 编辑备件信息
        /// </summary>
        /// <param name="spareInfo">备件信息</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("UpdateSpare")]
        public ResponseMessage UpdateSpare(SpareInfo spareInfo)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.EditSpare(spareInfo);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = " 修改备件信息" + spareInfo.spareName;
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "修改备件信息异常";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "修改备件信息";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }

        /// <summary>
        /// 删除备件信息
        /// </summary>
        /// <param name="spareInfo">备件id</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("DelSpare")]
        public ResponseMessage DelSpare(SpareInfo spareInfo)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.DelSpare(spareInfo.id);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = " 删除备件信息" + spareInfo.spareName;
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "删除备件信息失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "删除备件信息";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }

            return message;
        }

        /// <summary>
        /// 查询备件信息
        /// </summary>
        /// <param name="spareInfo">备件信息</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("QuerySpareList")]
        public ResponseMessage QuerySpareList(SpareInfo spareInfo)
        {
            ResponseMessage message = new ResponseMessage();
            try
            {
                SpareBUS BUS = new SpareBUS();
                message = BUS.QuerySpare(spareInfo);
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "查询备件信息失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "查询备件信息";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }

        /// <summary>
        /// 载入备件信息
        /// </summary>
        /// <param name="spareInfo">备件信息</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("LoadSpareInfo")]
        public ResponseMessage LoadSpareInfo(SpareInfo spareInfo)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.LoadSpare(spareInfo.id);
            }
            catch (Exception e)
            {
                message.errcode = 1;
                message.errmsg = "载入备件信息失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "载入备件信息";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }

        /// <summary>
        /// 清理备件信息
        /// </summary>
        /// <returns>success</returns>
        [HttpPost]
        [Route("CleanUpSpareData")]
        public ResponseMessage CleanUpSpareData()
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.CleanUpSpare();
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = " 清除所有备件信息";
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "清理备件信息失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "清理备件信息";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }

            return message;
        }

        /// <summary>
        /// 新增备件更换记录
        /// </summary>
        /// <param name="spareInfo">备件更换记录</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("AddSpareRecord")]
        public ResponseMessage AddSpareRecord(Spareupdaterecord spareupdaterecord)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                spareupdaterecord.creationPerson = _contextAccessor.HttpContext.Session.GetString("UserName");
                message = BUS.AddSpareRecord(spareupdaterecord);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = " 新增备件更换记录" + spareupdaterecord.spareName;
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 1;
                message.errmsg = "新增备件更换记录失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "新增备件更换记录";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }

        /// <summary>
        /// 编辑备件更换记录
        /// </summary>
        /// <param name="spareInfo">备件更换记录</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("UpdateSpareRecord")]
        public ResponseMessage UpdateSpareRecord(Spareupdaterecord spareupdaterecord)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.EditSpareRecord(spareupdaterecord);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = " 修改备件更换记录" + spareupdaterecord.spareName;
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "修改备件更换记录异常";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "修改备件更换记录";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }

        /// <summary>
        /// 删除备件更换记录
        /// </summary>
        /// <param name="spareInfo">备件更换记录id</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("DelSpareRecord")]
        public ResponseMessage DelSpareRecord(Spareupdaterecord spareupdaterecord)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.DelSpareRecord(spareupdaterecord.id);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = " 删除备件更换记录" + spareupdaterecord.spareName;
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "删除备件更换记录失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "删除备件更换记录";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }

            return message;
        }

        /// <summary>
        /// 查询备件更换记录
        /// </summary>
        /// <param name="spareInfo">备件更换记录</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("QuerySpareRecordList")]
        public ResponseMessage QuerySpareRecordList(Spareupdaterecord spareupdaterecord)
        {
            ResponseMessage message = new ResponseMessage();
            try
            {
                SpareBUS BUS = new SpareBUS();
                message = BUS.QuerySpareRecord(spareupdaterecord);
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "查询备件更换记录失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "查询备件更换记录";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }

        /// <summary>
        /// 载入备件更换记录
        /// </summary>
        /// <param name="spareInfo">备件更换记录</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("LoadSpareRecordInfo")]
        public ResponseMessage LoadSpareRecordInfo(Spareupdaterecord spareupdaterecord)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.LoadSpareRecord(spareupdaterecord.id);
            }
            catch (Exception e)
            {
                message.errcode = 1;
                message.errmsg = "载入备件更换记录失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "载入备件更换记录";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }

        /// <summary>
        /// 清理备件更换记录
        /// </summary>
        /// <returns>success</returns>
        [HttpPost]
        [Route("CleanUpSpareRecordData")]
        public ResponseMessage CleanUpSpareRecordData()
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.CleanUpSpareRecorde();
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = "清理备件更换记录";
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "清理备件更换记录失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "清理备件更换记录";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }

            return message;
        }

        /// <summary>
        /// 批量删除备件信息
        /// </summary>
        /// <param name="ids">备件id</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("BatchDelSpare")]
        public ResponseMessage BatchDelSpare(string ids)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.BatchDelSpare(ids);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = "批量删除备件信息" + ids;
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "批量删除备件信息失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "批量删除备件信息";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }

            return message;
        }

        /// <summary>
        /// 批量删除备件更换记录
        /// </summary>
        /// <param name="spareInfo">备件更换记录id</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("BatchDelSpareRecord")]
        public ResponseMessage BatchDelSpareRecord(string ids)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.BatchDelSpareRecord(ids);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = "批量删除备件更换记录" + ids;
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "批量删除备件更换记录失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "批量删除备件更换记录";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }

            return message;
        }

        /// <summary>
        /// 新增设备备件绑定关系
        /// </summary>
        /// <param name="spareElevator">设备备件关系</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("AddSpareElevator")]
        public ResponseMessage AddSpareElevator(SpareElevator spareElevator)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.AddSpareElevator(spareElevator);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = "新增设备备件绑定关系";
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 1;
                message.errmsg = "新增设备备件绑定关系失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "新增设备备件绑定关系";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }

        /// <summary>
        /// 批量删除设备备件绑定关系
        /// </summary>
        /// <param name="spareInfo">备件更换记录id</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("BatchDelSpareElevator")]
        public ResponseMessage BatchDelSpareElevator(string ids)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.BatchDelSpareElevator(ids);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = "新增设备备件绑定关系";
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "批量删除备件更换记录失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "批量删除备件更换记录";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }

            return message;
        }

        /// <summary>
        /// 删除备件信息
        /// </summary>
        /// <param name="spareElevator">备件</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("DelSpareElevator")]
        public ResponseMessage DelSpareElevator(SpareElevator spareElevator)
        {
            ResponseMessage message = new ResponseMessage();
            SpareBUS BUS = new SpareBUS();
            try
            {
                message = BUS.DelSpareElevator(spareElevator.id);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = "删除设备备件绑定关系";
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "删除备件信息失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "删除备件信息";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }

            return message;
        }

        /// <summary>
        /// 查询设备备件信息
        /// </summary>
        /// <param name="elevatorid">设备id</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("QuerySpareElevator")]
        public ResponseMessage QuerySpareElevator(int elevatorid)
        {
            ResponseMessage message = new ResponseMessage();
            try
            {
                SpareBUS BUS = new SpareBUS();
                message = BUS.QuerySpareElevator(elevatorid);
            }
            catch (Exception e)
            {
                message.errcode = 3;
                message.errmsg = "查询设备备件信息失败";
                message.data = null;
                message.total = 0;
                LogHelper.Log(e.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "查询设备备件信息";
                errorLogInfo.errorMsg = e.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }

        /// <summary>
        /// 导出备件更换记录
        /// </summary>
        /// <param name="inspectionPlanInfo">巡检信息</param>
        /// <returns>success</returns>
        [HttpPost]
        [Route("ExportSpareRecordHistory")]
        public ResponseMessage ExportSpareRecordHistory(Spareupdaterecord spareupdaterecord)
        {
            ResponseMessage message = new ResponseMessage();
            try
            {
                SpareBUS bus = new SpareBUS();
                string sWebRootFolder = _hostingEnvironment.WebRootPath;

                message = bus.ExportSpareRecordHistory(spareupdaterecord, sWebRootFolder);
                if (message.errcode == 0)
                {
                    string username = HttpContext.Session.GetString("UserName").ToString();
                    LogBUS logBUS = new LogBUS();
                    OperationLog operationLog = new OperationLog();
                    operationLog.operation = "导出备件更换记录";
                    operationLog.operatorName = username;
                    logBUS.InsertOperationLog(operationLog);
                }
            }
            catch (Exception ex)
            {
                message.errcode = 1;
                message.errmsg = "导出异常";
                LogHelper.Log(ex.ToString());
                LogBUS logBUS = new LogBUS();
                ErrorLogInfo errorLogInfo = new ErrorLogInfo();
                errorLogInfo.operation = "导出备件更换记录";
                errorLogInfo.errorMsg = ex.ToString();
                logBUS.InsertErrorLog(errorLogInfo);
            }
            return message;
        }
    }
}
